1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module soup.SessionFeatureT;
26 
27 public  import soup.Session;
28 public  import soup.c.functions;
29 public  import soup.c.types;
30 
31 
32 /**
33  * An object that implement some sort of optional feature for
34  * #SoupSession.
35  *
36  * Since: 2.24
37  */
38 public template SessionFeatureT(TStruct)
39 {
40 	/** Get the main Gtk struct */
41 	public SoupSessionFeature* getSessionFeatureStruct(bool transferOwnership = false)
42 	{
43 		if (transferOwnership)
44 			ownedRef = false;
45 		return cast(SoupSessionFeature*)getStruct();
46 	}
47 
48 
49 	/**
50 	 * Adds a "sub-feature" of type @type to the base feature @feature.
51 	 * This is used for features that can be extended with multiple
52 	 * different types. Eg, the authentication manager can be extended
53 	 * with subtypes of #SoupAuth.
54 	 *
55 	 * Params:
56 	 *     type = the #GType of a "sub-feature"
57 	 *
58 	 * Returns: %TRUE if @feature accepted @type as a subfeature.
59 	 *
60 	 * Since: 2.34
61 	 */
62 	public bool addFeature(GType type)
63 	{
64 		return soup_session_feature_add_feature(getSessionFeatureStruct(), type) != 0;
65 	}
66 
67 	/** */
68 	public void attach(Session session)
69 	{
70 		soup_session_feature_attach(getSessionFeatureStruct(), (session is null) ? null : session.getSessionStruct());
71 	}
72 
73 	/** */
74 	public void detach(Session session)
75 	{
76 		soup_session_feature_detach(getSessionFeatureStruct(), (session is null) ? null : session.getSessionStruct());
77 	}
78 
79 	/**
80 	 * Tests if @feature has a "sub-feature" of type @type. See
81 	 * soup_session_feature_add_feature().
82 	 *
83 	 * Params:
84 	 *     type = the #GType of a "sub-feature"
85 	 *
86 	 * Returns: %TRUE if @feature has a subfeature of type @type
87 	 *
88 	 * Since: 2.34
89 	 */
90 	public bool hasFeature(GType type)
91 	{
92 		return soup_session_feature_has_feature(getSessionFeatureStruct(), type) != 0;
93 	}
94 
95 	/**
96 	 * Removes the "sub-feature" of type @type from the base feature
97 	 * @feature. See soup_session_feature_add_feature().
98 	 *
99 	 * Params:
100 	 *     type = the #GType of a "sub-feature"
101 	 *
102 	 * Returns: %TRUE if @type was removed from @feature
103 	 *
104 	 * Since: 2.34
105 	 */
106 	public bool removeFeature(GType type)
107 	{
108 		return soup_session_feature_remove_feature(getSessionFeatureStruct(), type) != 0;
109 	}
110 }